import Vue from "vue";
import App from "./App.vue";
import ElementUI from "element-ui";
import "element-ui/lib/theme-chalk/index.css";
import store from "./store/index.js";

import router from "./router";

import axios from "axios";
Vue.prototype.axios = axios;

//Vue.prototype.$http = axios

Vue.config.productionTip = false;
Vue.use(ElementUI);

Vue.prototype.SetTime = "";

Vue.prototype.changeData = function() {
  //changeData是函数名
  let text = this.$store.state.objectPath.ReturnValue;
  let a, b, c;
  // console.log(text)
  if (text == undefined) {
    this.ObjectPath = this.$store.state.Addressprefix;
  } else {
    for (let i = 0; i < text.length; i++) {
      let test = text[i].match(this.text);
      if (test != null) {
        c = test.input;
        a = c;
        b = a.lastIndexOf("_");
        if (b != -1) {
          a = a.slice(test.index, b);
        } else if (b < 0) {
          a = a.slice(test.index);
        }
        if (a == this.text) {
          this.ObjectPath = c;
        }
      }
    }
  }
};

Vue.prototype.UpMaps = function() {
  let index = this.$store.state.objectPath.ReturnValue[1];
  // console.log(index)
  if (index == undefined) {
    // console.log(this.$store.state.Addressprefix)
    let inputMaspsText = this.$store.state.Addressprefix;
    this.$store.commit("serObjectPath", inputMaspsText);
  } else {
    let right = index.lastIndexOf("/");
    let left = index.indexOf(".");
    this.textMap = index.slice(right + 1, left);
  }
};

new Vue({
  render: (h) => h(App),
  router,
  store,
}).$mount("#app");
